package com.m3958.firstgwt.client.datasource;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.m3958.firstgwt.client.constants.AsyncTaskFieldConstants;
import com.m3958.firstgwt.client.types.AsyncTaskField;
import com.m3958.firstgwt.shared.type.CommonField;
import com.smartgwt.client.data.fields.DataSourceBooleanField;
import com.smartgwt.client.data.fields.DataSourceTextField;


@Singleton
public class AsyncTaskDataSource extends BaseDataSource{

    public static String className = "com.m3958.firstgwt.server.model.AsyncTask";
    
    @Inject
    public AsyncTaskDataSource(DsErrorHandler deh,AsyncTaskFieldConstants constants) {
    	setID("asyncTaskDS");
        DataSourceTextField nameField = new DataSourceTextField(CommonField.NAME.getValue(),constants.name());
        DataSourceTextField catagoryField = new DataSourceTextField(AsyncTaskField.CATAGORY.getValue(),constants.catagory());
        DataSourceTextField taskDescriptField = new DataSourceTextField(AsyncTaskField.TASK_DESCRIPT.getValue(),constants.taskDescript());
        
        DataSourceTextField errorMsgField = new DataSourceTextField(AsyncTaskField.ERROR_MSG.getValue(),constants.errorMsg());
        
        DataSourceTextField statustField = new DataSourceTextField(AsyncTaskField.STATUS.getValue(),constants.status());
        
        DataSourceBooleanField notifiedField = new DataSourceBooleanField(AsyncTaskField.NOTIFIED.getValue(), constants.notified());
        addHandleErrorHandler(deh);
        
        setFields(getIdField(),nameField,catagoryField,statustField,notifiedField,taskDescriptField,errorMsgField,getCreatedAtField(false,constants));
        setClientOnly(false);
       
    }

	@Override
	protected String getModelClassName() {
		return className;
	}
}
